Integrand size = 25, antiderivative size = 126 \[ \int \frac {(a+b \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=-\frac {(b (c-d)-a (c+d)) (a (c-d)+b (c+d)) x}{\left (c^2+d^2\right )^2}-\frac {2 (b c-a d) (a c+b d) \log (c \cos (e+f x)+d \sin (e+f x))}{\left (c^2+d^2\right )^2 f}-\frac {(b c-a d)^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))} \]
[Out]
Time = 0.27 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.120, Rules used = {3623, 3612, 3611} \[ \int \frac {(a+b \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=-\frac {(b c-a d)^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}-\frac {2 (a c+b d) (b c-a d) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^2}-\frac {x (b (c-d)-a (c+d)) (a (c-d)+b (c+d))}{\left (c^2+d^2\right )^2} \]
[In]
[Out]
Rule 3611
Rule 3612
Rule 3623
Rubi steps \begin{align*} \text {integral}& = -\frac {(b c-a d)^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))}+\frac {\int \frac {a^2 c-b^2 c+2 a b d+\left (2 a b c-a^2 d+b^2 d\right ) \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{c^2+d^2} \\ & = -\frac {(b (c-d)-a (c+d)) (a (c-d)+b (c+d)) x}{\left (c^2+d^2\right )^2}-\frac {(b c-a d)^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))}-\frac {(2 (b c-a d) (a c+b d)) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{\left (c^2+d^2\right )^2} \\ & = -\frac {(b (c-d)-a (c+d)) (a (c-d)+b (c+d)) x}{\left (c^2+d^2\right )^2}-\frac {2 (b c-a d) (a c+b d) \log (c \cos (e+f x)+d \sin (e+f x))}{\left (c^2+d^2\right )^2 f}-\frac {(b c-a d)^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))} \\ \end{align*}
Result contains complex when optimal does not.
Time = 1.85 (sec) , antiderivative size = 214, normalized size of antiderivative = 1.70 \[ \int \frac {(a+b \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=\frac {(b c-a d) \left (\frac {(a+i b)^2 (i c+d) \log (i-\tan (e+f x))}{c+i d}+\frac {(a-i b)^2 (c+i d) \log (i+\tan (e+f x))}{i c+d}+\frac {4 (b c-a d) (a c+b d) \log (c+d \tan (e+f x))}{c^2+d^2}\right )-2 b^2 (b c-a d) \tan (e+f x)+2 b d (a+b \tan (e+f x))^2-\frac {2 d^2 (a+b \tan (e+f x))^3}{c+d \tan (e+f x)}}{2 (-b c+a d) \left (c^2+d^2\right ) f} \]
[In]
[Out]
Time = 0.25 (sec) , antiderivative size = 200, normalized size of antiderivative = 1.59
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (-2 a^{2} c d +2 a b \,c^{2}-2 a b \,d^{2}+2 b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{2} c^{2}-a^{2} d^{2}+4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}-\frac {a^{2} d^{2}-2 a b c d +b^{2} c^{2}}{\left (c^{2}+d^{2}\right ) d \left (c +d \tan \left (f x +e \right )\right )}+\frac {2 \left (a^{2} c d -a b \,c^{2}+a b \,d^{2}-b^{2} c d \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}}{f}\) | \(200\) |
default | \(\frac {\frac {\frac {\left (-2 a^{2} c d +2 a b \,c^{2}-2 a b \,d^{2}+2 b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{2} c^{2}-a^{2} d^{2}+4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}-\frac {a^{2} d^{2}-2 a b c d +b^{2} c^{2}}{\left (c^{2}+d^{2}\right ) d \left (c +d \tan \left (f x +e \right )\right )}+\frac {2 \left (a^{2} c d -a b \,c^{2}+a b \,d^{2}-b^{2} c d \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}}{f}\) | \(200\) |
norman | \(\frac {\frac {c \left (a^{2} c^{2}-a^{2} d^{2}+4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) x}{c^{4}+2 c^{2} d^{2}+d^{4}}+\frac {d \left (a^{2} c^{2}-a^{2} d^{2}+4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) x \tan \left (f x +e \right )}{c^{4}+2 c^{2} d^{2}+d^{4}}+\frac {\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \tan \left (f x +e \right )}{c f \left (c^{2}+d^{2}\right )}}{c +d \tan \left (f x +e \right )}-\frac {\left (a^{2} c d -a b \,c^{2}+a b \,d^{2}-b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}+\frac {2 \left (a^{2} c d -a b \,c^{2}+a b \,d^{2}-b^{2} c d \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}\) | \(299\) |
parallelrisch | \(-\frac {-\tan \left (f x +e \right ) b^{2} c^{4}+\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} c^{2} d^{2}-\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) \tan \left (f x +e \right ) b^{2} c^{2} d^{2}+\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a b \,c^{2} d^{2}-\tan \left (f x +e \right ) a^{2} d^{4}+2 \tan \left (f x +e \right ) a b \,c^{3} d +2 \tan \left (f x +e \right ) a b c \,d^{3}-\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) b^{2} c^{3} d +\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c^{3} d -\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a b \,c^{4}-2 \ln \left (c +d \tan \left (f x +e \right )\right ) a^{2} c^{3} d +2 \ln \left (c +d \tan \left (f x +e \right )\right ) a b \,c^{4}+2 \ln \left (c +d \tan \left (f x +e \right )\right ) b^{2} c^{3} d -\tan \left (f x +e \right ) a^{2} c^{2} d^{2}-\tan \left (f x +e \right ) b^{2} c^{2} d^{2}-x \,a^{2} c^{4} f +x \,b^{2} c^{4} f -2 \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} c^{2} d^{2}+2 \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) b^{2} c^{2} d^{2}-2 \ln \left (c +d \tan \left (f x +e \right )\right ) a b \,c^{2} d^{2}+x \,a^{2} c^{2} d^{2} f -x \,b^{2} c^{2} d^{2} f -x \tan \left (f x +e \right ) a^{2} c^{3} d f +x \tan \left (f x +e \right ) a^{2} c \,d^{3} f +x \tan \left (f x +e \right ) b^{2} c^{3} d f -x \tan \left (f x +e \right ) b^{2} c \,d^{3} f -4 x a b \,c^{3} d f +2 \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a b \,c^{3} d -2 \ln \left (c +d \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a b c \,d^{3}-4 x \tan \left (f x +e \right ) a b \,c^{2} d^{2} f -\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) \tan \left (f x +e \right ) a b \,c^{3} d +\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) \tan \left (f x +e \right ) a b c \,d^{3}}{\left (c +d \tan \left (f x +e \right )\right ) \left (c^{2}+d^{2}\right )^{2} c f}\) | \(625\) |
risch | \(-\frac {4 i x \,a^{2} c d}{c^{4}+2 c^{2} d^{2}+d^{4}}-\frac {a^{2} x}{2 i c d -c^{2}+d^{2}}+\frac {x \,b^{2}}{2 i c d -c^{2}+d^{2}}-\frac {4 i a b c d}{\left (i d +c \right ) f \left (-i d +c \right )^{2} \left (-i {\mathrm e}^{2 i \left (f x +e \right )} d +{\mathrm e}^{2 i \left (f x +e \right )} c +i d +c \right )}-\frac {4 i a^{2} c d e}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}-\frac {4 i x a b \,d^{2}}{c^{4}+2 c^{2} d^{2}+d^{4}}+\frac {2 i x a b}{2 i c d -c^{2}+d^{2}}+\frac {4 i b^{2} c d e}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}+\frac {2 i a^{2} d^{2}}{\left (i d +c \right ) f \left (-i d +c \right )^{2} \left (-i {\mathrm e}^{2 i \left (f x +e \right )} d +{\mathrm e}^{2 i \left (f x +e \right )} c +i d +c \right )}+\frac {4 i a b \,c^{2} e}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}+\frac {4 i x \,b^{2} c d}{c^{4}+2 c^{2} d^{2}+d^{4}}+\frac {2 i b^{2} c^{2}}{\left (i d +c \right ) f \left (-i d +c \right )^{2} \left (-i {\mathrm e}^{2 i \left (f x +e \right )} d +{\mathrm e}^{2 i \left (f x +e \right )} c +i d +c \right )}-\frac {4 i a b \,d^{2} e}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}+\frac {4 i x a b \,c^{2}}{c^{4}+2 c^{2} d^{2}+d^{4}}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a^{2} c d}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a b \,c^{2}}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a b \,d^{2}}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) b^{2} c d}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}\) | \(689\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 294 vs. \(2 (125) = 250\).
Time = 0.26 (sec) , antiderivative size = 294, normalized size of antiderivative = 2.33 \[ \int \frac {(a+b \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=-\frac {b^{2} c^{2} d - 2 \, a b c d^{2} + a^{2} d^{3} - {\left (4 \, a b c^{2} d + {\left (a^{2} - b^{2}\right )} c^{3} - {\left (a^{2} - b^{2}\right )} c d^{2}\right )} f x + {\left (a b c^{3} - a b c d^{2} - {\left (a^{2} - b^{2}\right )} c^{2} d + {\left (a b c^{2} d - a b d^{3} - {\left (a^{2} - b^{2}\right )} c d^{2}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (b^{2} c^{3} - 2 \, a b c^{2} d + a^{2} c d^{2} + {\left (4 \, a b c d^{2} + {\left (a^{2} - b^{2}\right )} c^{2} d - {\left (a^{2} - b^{2}\right )} d^{3}\right )} f x\right )} \tan \left (f x + e\right )}{{\left (c^{4} d + 2 \, c^{2} d^{3} + d^{5}\right )} f \tan \left (f x + e\right ) + {\left (c^{5} + 2 \, c^{3} d^{2} + c d^{4}\right )} f} \]
[In]
[Out]
Result contains complex when optimal does not.
Time = 0.89 (sec) , antiderivative size = 4258, normalized size of antiderivative = 33.79 \[ \int \frac {(a+b \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=\text {Too large to display} \]
[In]
[Out]
none
Time = 0.31 (sec) , antiderivative size = 229, normalized size of antiderivative = 1.82 \[ \int \frac {(a+b \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {{\left (4 \, a b c d + {\left (a^{2} - b^{2}\right )} c^{2} - {\left (a^{2} - b^{2}\right )} d^{2}\right )} {\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {2 \, {\left (a b c^{2} - a b d^{2} - {\left (a^{2} - b^{2}\right )} c d\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac {{\left (a b c^{2} - a b d^{2} - {\left (a^{2} - b^{2}\right )} c d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}}{c^{3} d + c d^{3} + {\left (c^{2} d^{2} + d^{4}\right )} \tan \left (f x + e\right )}}{f} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 323 vs. \(2 (125) = 250\).
Time = 0.51 (sec) , antiderivative size = 323, normalized size of antiderivative = 2.56 \[ \int \frac {(a+b \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {{\left (a^{2} c^{2} - b^{2} c^{2} + 4 \, a b c d - a^{2} d^{2} + b^{2} d^{2}\right )} {\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac {{\left (a b c^{2} - a^{2} c d + b^{2} c d - a b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {2 \, {\left (a b c^{2} d - a^{2} c d^{2} + b^{2} c d^{2} - a b d^{3}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{4} d + 2 \, c^{2} d^{3} + d^{5}} + \frac {2 \, a b c^{2} d^{2} \tan \left (f x + e\right ) - 2 \, a^{2} c d^{3} \tan \left (f x + e\right ) + 2 \, b^{2} c d^{3} \tan \left (f x + e\right ) - 2 \, a b d^{4} \tan \left (f x + e\right ) - b^{2} c^{4} + 4 \, a b c^{3} d - 3 \, a^{2} c^{2} d^{2} + b^{2} c^{2} d^{2} - a^{2} d^{4}}{{\left (c^{4} d + 2 \, c^{2} d^{3} + d^{5}\right )} {\left (d \tan \left (f x + e\right ) + c\right )}}}{f} \]
[In]
[Out]
Time = 8.21 (sec) , antiderivative size = 208, normalized size of antiderivative = 1.65 \[ \int \frac {(a+b \tan (e+f x))^2}{(c+d \tan (e+f x))^2} \, dx=\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (-2\,a\,b\,c^2+\left (2\,a^2-2\,b^2\right )\,c\,d+2\,a\,b\,d^2\right )}{f\,\left (c^4+2\,c^2\,d^2+d^4\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (a^2+a\,b\,2{}\mathrm {i}-b^2\right )}{2\,f\,\left (-c^2\,1{}\mathrm {i}+2\,c\,d+d^2\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a^2\,1{}\mathrm {i}+2\,a\,b-b^2\,1{}\mathrm {i}\right )}{2\,f\,\left (-c^2+c\,d\,2{}\mathrm {i}+d^2\right )}-\frac {a^2\,d^2-2\,a\,b\,c\,d+b^2\,c^2}{d\,f\,\left (c^2+d^2\right )\,\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )} \]
[In]
[Out]